package com.ghh.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.ghh.constant.MessageConstant;
import com.ghh.entity.Result;
import com.ghh.service.CompanyService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/company")
public class CompanyController {

    @Reference
    private CompanyService companyService;

    @RequestMapping("/findAll")
    public Result findAll(){
        try {
            List<Map<String,Object>> list = companyService.findAllCompany();
            return new Result(true, MessageConstant.GET_COMPANY_SUCCESS,list);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false, MessageConstant.GET_COMPANY_FAIL);
        }
    }
}
